package com.itheima.stargraph.controller;

import com.itheima.stargraph.dto.common.Result;
import com.itheima.stargraph.dto.request.UserLoginReqDTO;
import com.itheima.stargraph.service.UserService;
import jakarta.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * TODO
 *
 * @Author huang
 * @Date 2025/6/11 2025/6/11
 */
@RestController
@RequestMapping("/api/1.0/user")
public class UserController {
    @Autowired
    private UserService userService;

    /**
     * 用户登录
     * @param dto
     * @return
     */
    @PostMapping("/login")
    public Result login(@RequestBody @Valid UserLoginReqDTO dto){
        return Result.ok(userService.login(dto));
    }
}
